using CoreManager.Models.DTOs;

namespace CoreManager.Services.Menus
{
    /// <summary>
    /// 菜单服务接口
    /// </summary>
    public interface IMenuService
    {
        /// <summary>
        /// 获取菜单树
        /// </summary>
        /// <returns></returns>
        Task<ApiResponse<List<MenuDto>>> GetMenuTreeAsync();

        /// <summary>
        /// 根据用户ID获取用户菜单
        /// </summary>
        /// <param name="userId">用户ID</param>
        /// <returns></returns>
        Task<ApiResponse<List<MenuDto>>> GetUserMenusAsync(int userId);

        /// <summary>
        /// 根据ID获取菜单详情
        /// </summary>
        /// <param name="id">菜单ID</param>
        /// <returns></returns>
        Task<ApiResponse<MenuDto>> GetMenuByIdAsync(int id);

        /// <summary>
        /// 根据查询条件获取菜单列表
        /// </summary>
        /// <param name="query">查询条件</param>
        /// <returns></returns>
        Task<ApiResponse<List<MenuDto>>> GetMenusAsync(MenuQueryDto query);

        /// <summary>
        /// 创建菜单
        /// </summary>
        /// <param name="createDto">创建菜单DTO</param>
        /// <returns></returns>
        Task<ApiResponse<MenuDto>> CreateMenuAsync(CreateMenuDto createDto);

        /// <summary>
        /// 更新菜单
        /// </summary>
        /// <param name="id">菜单ID</param>
        /// <param name="updateDto">更新菜单DTO</param>
        /// <returns></returns>
        Task<ApiResponse<MenuDto>> UpdateMenuAsync(int id, UpdateMenuDto updateDto);

        /// <summary>
        /// 根据Key更新菜单
        /// </summary>
        /// <param name="key">菜单Key</param>
        /// <param name="updateDto">更新菜单DTO</param>
        /// <returns></returns>
        Task<ApiResponse<MenuDto>> UpdateMenuByKeyAsync(string key, UpdateMenuDto updateDto);

        /// <summary>
        /// 删除菜单
        /// </summary>
        /// <param name="id">菜单ID</param>
        /// <returns></returns>
        Task<ApiResponse<bool>> DeleteMenuAsync(int id);

        /// <summary>
        /// 批量删除菜单
        /// </summary>
        /// <param name="ids">菜单ID列表</param>
        /// <returns></returns>
        Task<ApiResponse<bool>> BatchDeleteMenusAsync(List<int> ids);

        /// <summary>
        /// 更新菜单状态
        /// </summary>
        /// <param name="id">菜单ID</param>
        /// <param name="status">状态</param>
        /// <returns></returns>
        Task<ApiResponse<bool>> UpdateMenuStatusAsync(int id, int status);

        /// <summary>
        /// 批量更新菜单状态
        /// </summary>
        /// <param name="ids">菜单ID列表</param>
        /// <param name="status">状态</param>
        /// <returns></returns>
        Task<ApiResponse<bool>> BatchUpdateMenuStatusAsync(List<int> ids, int status);

        /// <summary>
        /// 获取父级菜单选项
        /// </summary>
        /// <returns></returns>
        Task<ApiResponse<List<MenuDto>>> GetParentMenuOptionsAsync();

        /// <summary>
        /// 检查菜单Key是否存在
        /// </summary>
        /// <param name="key">菜单Key</param>
        /// <param name="excludeId">排除的菜单ID</param>
        /// <returns></returns>
        Task<ApiResponse<bool>> CheckMenuKeyExistsAsync(string key, int? excludeId = null);
    }
}